/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package zpsb.session;

import java.util.List;
import javax.ejb.Stateful;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import zpsb.model.Product;

/**
 *
 * @author School
 */
@Stateful
@LocalBean
public class ImionaCounter {

    @PersistenceContext
    EntityManager em;
    
    private Integer counter=0;
    public void increase(){
        counter++;
    }
    public List<Product> getProducts(){
        TypedQuery<Product> q = em.createQuery("Select p from Product p",Product.class);
        return q.getResultList();
    }
    
    
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")

    public Integer getCounter() {
        return counter;
    }

    
    
}
